/*
* Copyright 2004-2005 mbsx@seznam.cz
* All Rights Reserved.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DeskNotes
{
	/// <summary>
	/// Summary description for SettingsDialog.
	/// </summary>
	public class SettingsDialog : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.ColorDialog colorDialog;
		private System.Windows.Forms.OpenFileDialog openSound;
		private System.Windows.Forms.ToolTip toolTip;
		private System.ComponentModel.IContainer components;
		internal string[] langs = new string[2]{new System.Globalization.CultureInfo("en-US").NativeName,
									 new System.Globalization.CultureInfo("cs-CZ").NativeName};
		private System.Windows.Forms.TabControl tabData;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		internal System.Windows.Forms.Button btnText;
		private System.Windows.Forms.Label label2;
		internal System.Windows.Forms.Button btnBackground;
		private System.Windows.Forms.Label label1;
		internal System.Windows.Forms.ComboBox comboLanguage;
        private System.Windows.Forms.Label label3;
		internal System.Windows.Forms.Button btnSound;
		internal System.Windows.Forms.TextBox txtSound;
		internal System.Windows.Forms.CheckBox chkSound;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button btnFont;
		private System.Windows.Forms.FontDialog fontDialog;
		internal System.Windows.Forms.Label lblFont;
		internal System.Windows.Forms.CheckBox chkInsertOnlyDate;
		private System.Windows.Forms.TabPage tabPage3;
		private System.Windows.Forms.GroupBox groupBox1;
		internal System.Windows.Forms.RadioButton rbDragDrop;
		internal System.Windows.Forms.RadioButton rbArchive;
		private System.Windows.Forms.GroupBox groupBox2;
		internal System.Windows.Forms.RadioButton rbOwn;
		internal System.Windows.Forms.RadioButton rbSystem;
        private TabPage tabPage4;
        internal OwnControls.DataStorageControl dataStorage;
        internal CheckBox chkRemoveOutlook;
        private TextBox textBox1;

		//internal string opacityText;

		public SettingsDialog()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			//Display languages in combo using their native names
			comboLanguage.Items.AddRange(langs);
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsDialog));
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.colorDialog = new System.Windows.Forms.ColorDialog();
            this.openSound = new System.Windows.Forms.OpenFileDialog();
            this.toolTip = new System.Windows.Forms.ToolTip(this.components);
            this.btnFont = new System.Windows.Forms.Button();
            this.lblFont = new System.Windows.Forms.Label();
            this.btnText = new System.Windows.Forms.Button();
            this.btnBackground = new System.Windows.Forms.Button();
            this.comboLanguage = new System.Windows.Forms.ComboBox();
            this.btnSound = new System.Windows.Forms.Button();
            this.txtSound = new System.Windows.Forms.TextBox();
            this.chkSound = new System.Windows.Forms.CheckBox();
            this.chkRemoveOutlook = new System.Windows.Forms.CheckBox();
            this.tabData = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.chkInsertOnlyDate = new System.Windows.Forms.CheckBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.rbSystem = new System.Windows.Forms.RadioButton();
            this.rbOwn = new System.Windows.Forms.RadioButton();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.rbArchive = new System.Windows.Forms.RadioButton();
            this.rbDragDrop = new System.Windows.Forms.RadioButton();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.label3 = new System.Windows.Forms.Label();
            this.tabPage4 = new System.Windows.Forms.TabPage();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.dataStorage = new OwnControls.DataStorageControl();
            this.fontDialog = new System.Windows.Forms.FontDialog();
            this.tabData.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabPage3.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.tabPage4.SuspendLayout();
            this.SuspendLayout();
            // 
            // btnOK
            // 
            resources.ApplyResources(this.btnOK, "btnOK");
            this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.btnOK.Name = "btnOK";
            this.toolTip.SetToolTip(this.btnOK, resources.GetString("btnOK.ToolTip"));
            // 
            // btnCancel
            // 
            resources.ApplyResources(this.btnCancel, "btnCancel");
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Name = "btnCancel";
            this.toolTip.SetToolTip(this.btnCancel, resources.GetString("btnCancel.ToolTip"));
            // 
            // openSound
            // 
            this.openSound.DefaultExt = "WAV";
            resources.ApplyResources(this.openSound, "openSound");
            // 
            // btnFont
            // 
            resources.ApplyResources(this.btnFont, "btnFont");
            this.btnFont.Name = "btnFont";
            this.toolTip.SetToolTip(this.btnFont, resources.GetString("btnFont.ToolTip"));
            this.btnFont.Click += new System.EventHandler(this.btnFont_Click);
            // 
            // lblFont
            // 
            resources.ApplyResources(this.lblFont, "lblFont");
            this.lblFont.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.lblFont.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.lblFont.Name = "lblFont";
            this.toolTip.SetToolTip(this.lblFont, resources.GetString("lblFont.ToolTip"));
            this.lblFont.FontChanged += new System.EventHandler(this.lblFont_FontChanged);
            // 
            // btnText
            // 
            resources.ApplyResources(this.btnText, "btnText");
            this.btnText.Name = "btnText";
            this.toolTip.SetToolTip(this.btnText, resources.GetString("btnText.ToolTip"));
            this.btnText.Click += new System.EventHandler(this.btnText_Click);
            // 
            // btnBackground
            // 
            resources.ApplyResources(this.btnBackground, "btnBackground");
            this.btnBackground.BackColor = System.Drawing.SystemColors.Control;
            this.btnBackground.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnBackground.Name = "btnBackground";
            this.toolTip.SetToolTip(this.btnBackground, resources.GetString("btnBackground.ToolTip"));
            this.btnBackground.UseVisualStyleBackColor = false;
            this.btnBackground.Click += new System.EventHandler(this.btnBackground_Click);
            // 
            // comboLanguage
            // 
            resources.ApplyResources(this.comboLanguage, "comboLanguage");
            this.comboLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboLanguage.Name = "comboLanguage";
            this.toolTip.SetToolTip(this.comboLanguage, resources.GetString("comboLanguage.ToolTip"));
            this.comboLanguage.SelectionChangeCommitted += new System.EventHandler(this.comboLanguage_SelectionChangeCommitted);
            // 
            // btnSound
            // 
            resources.ApplyResources(this.btnSound, "btnSound");
            this.btnSound.Name = "btnSound";
            this.toolTip.SetToolTip(this.btnSound, resources.GetString("btnSound.ToolTip"));
            this.btnSound.Click += new System.EventHandler(this.btnSound_Click);
            // 
            // txtSound
            // 
            resources.ApplyResources(this.txtSound, "txtSound");
            this.txtSound.Name = "txtSound";
            this.toolTip.SetToolTip(this.txtSound, resources.GetString("txtSound.ToolTip"));
            // 
            // chkSound
            // 
            resources.ApplyResources(this.chkSound, "chkSound");
            this.chkSound.Name = "chkSound";
            this.toolTip.SetToolTip(this.chkSound, resources.GetString("chkSound.ToolTip"));
            this.chkSound.CheckedChanged += new System.EventHandler(this.chkSound_CheckedChanged);
            // 
            // chkRemoveOutlook
            // 
            resources.ApplyResources(this.chkRemoveOutlook, "chkRemoveOutlook");
            this.chkRemoveOutlook.Name = "chkRemoveOutlook";
            this.toolTip.SetToolTip(this.chkRemoveOutlook, resources.GetString("chkRemoveOutlook.ToolTip"));
            this.chkRemoveOutlook.UseVisualStyleBackColor = true;
            // 
            // tabData
            // 
            resources.ApplyResources(this.tabData, "tabData");
            this.tabData.Controls.Add(this.tabPage1);
            this.tabData.Controls.Add(this.tabPage3);
            this.tabData.Controls.Add(this.tabPage2);
            this.tabData.Controls.Add(this.tabPage4);
            this.tabData.Name = "tabData";
            this.tabData.SelectedIndex = 0;
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.chkInsertOnlyDate);
            this.tabPage1.Controls.Add(this.btnFont);
            this.tabPage1.Controls.Add(this.lblFont);
            this.tabPage1.Controls.Add(this.label6);
            this.tabPage1.Controls.Add(this.btnText);
            this.tabPage1.Controls.Add(this.label2);
            this.tabPage1.Controls.Add(this.btnBackground);
            this.tabPage1.Controls.Add(this.label1);
            resources.ApplyResources(this.tabPage1, "tabPage1");
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.UseVisualStyleBackColor = true;
            // 
            // chkInsertOnlyDate
            // 
            resources.ApplyResources(this.chkInsertOnlyDate, "chkInsertOnlyDate");
            this.chkInsertOnlyDate.Name = "chkInsertOnlyDate";
            // 
            // label6
            // 
            resources.ApplyResources(this.label6, "label6");
            this.label6.Name = "label6";
            // 
            // label2
            // 
            this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
            resources.ApplyResources(this.label2, "label2");
            this.label2.Name = "label2";
            // 
            // label1
            // 
            this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            resources.ApplyResources(this.label1, "label1");
            this.label1.Name = "label1";
            // 
            // tabPage3
            // 
            this.tabPage3.Controls.Add(this.groupBox2);
            this.tabPage3.Controls.Add(this.groupBox1);
            resources.ApplyResources(this.tabPage3, "tabPage3");
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.UseVisualStyleBackColor = true;
            // 
            // groupBox2
            // 
            resources.ApplyResources(this.groupBox2, "groupBox2");
            this.groupBox2.Controls.Add(this.rbSystem);
            this.groupBox2.Controls.Add(this.rbOwn);
            this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.TabStop = false;
            // 
            // rbSystem
            // 
            resources.ApplyResources(this.rbSystem, "rbSystem");
            this.rbSystem.Name = "rbSystem";
            // 
            // rbOwn
            // 
            resources.ApplyResources(this.rbOwn, "rbOwn");
            this.rbOwn.Name = "rbOwn";
            // 
            // groupBox1
            // 
            resources.ApplyResources(this.groupBox1, "groupBox1");
            this.groupBox1.Controls.Add(this.rbArchive);
            this.groupBox1.Controls.Add(this.rbDragDrop);
            this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.TabStop = false;
            // 
            // rbArchive
            // 
            resources.ApplyResources(this.rbArchive, "rbArchive");
            this.rbArchive.Name = "rbArchive";
            // 
            // rbDragDrop
            // 
            resources.ApplyResources(this.rbDragDrop, "rbDragDrop");
            this.rbDragDrop.Name = "rbDragDrop";
            // 
            // tabPage2
            // 
            this.tabPage2.Controls.Add(this.comboLanguage);
            this.tabPage2.Controls.Add(this.label3);
            this.tabPage2.Controls.Add(this.btnSound);
            this.tabPage2.Controls.Add(this.txtSound);
            this.tabPage2.Controls.Add(this.chkSound);
            resources.ApplyResources(this.tabPage2, "tabPage2");
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.UseVisualStyleBackColor = true;
            // 
            // label3
            // 
            resources.ApplyResources(this.label3, "label3");
            this.label3.Name = "label3";
            // 
            // tabPage4
            // 
            this.tabPage4.Controls.Add(this.chkRemoveOutlook);
            this.tabPage4.Controls.Add(this.textBox1);
            this.tabPage4.Controls.Add(this.dataStorage);
            resources.ApplyResources(this.tabPage4, "tabPage4");
            this.tabPage4.Name = "tabPage4";
            this.tabPage4.UseVisualStyleBackColor = true;
            // 
            // textBox1
            // 
            resources.ApplyResources(this.textBox1, "textBox1");
            this.textBox1.BackColor = System.Drawing.SystemColors.ControlLight;
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            // 
            // dataStorage
            // 
            resources.ApplyResources(this.dataStorage, "dataStorage");
            this.dataStorage.ArchiveFileName = "";
            this.dataStorage.CheckFileExists = true;
            this.dataStorage.DataFileName = "";
            this.dataStorage.Name = "dataStorage";
            this.dataStorage.OpenDirectory = false;
            // 
            // SettingsDialog
            // 
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.tabData);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnOK);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "SettingsDialog";
            this.tabData.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage3.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.tabPage2.ResumeLayout(false);
            this.tabPage2.PerformLayout();
            this.tabPage4.ResumeLayout(false);
            this.tabPage4.PerformLayout();
            this.ResumeLayout(false);

		}
		#endregion

		private void btnBackground_Click(object sender, System.EventArgs e)
		{
			colorDialog.Color = btnBackground.BackColor;
			if (DialogResult.OK == colorDialog.ShowDialog(this))
				btnBackground.BackColor = colorDialog.Color;
		}

		private void btnText_Click(object sender, System.EventArgs e)
		{
			colorDialog.Color = btnText.BackColor;
			if (DialogResult.OK == colorDialog.ShowDialog(this))
				btnText.BackColor = colorDialog.Color;
		}

		private void chkSound_CheckedChanged(object sender, System.EventArgs e)
		{
			txtSound.Enabled = chkSound.Checked;
			btnSound.Enabled = chkSound.Checked;
		}

		private void btnSound_Click(object sender, System.EventArgs e)
		{
			openSound.FileName = txtSound.Text;
			if (DialogResult.OK == openSound.ShowDialog())
			{
				txtSound.Text = openSound.FileName;
			}
		}

		

		/// <summary>
		/// Displays warning that language is changed only after restart.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void comboLanguage_SelectionChangeCommitted(object sender, System.EventArgs e)
		{
			MessageBox.Show(this,MainResource.GetString("LANGUAGE_CHANGED"),MainResource.GetString("APP_TITLE"),
				MessageBoxButtons.OK,MessageBoxIcon.Information);
				
		}

		private void btnFont_Click(object sender, System.EventArgs e)
		{
			fontDialog.Font = lblFont.Font;
			if (DialogResult.OK == fontDialog.ShowDialog())
				lblFont.Font = fontDialog.Font;
		}

		private void lblFont_FontChanged(object sender, System.EventArgs e)
		{
			lblFont.Text = lblFont.Font.Name;
		}
	}
}
